﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using zhangmenren.IService;
using zhangmenren.Models;
using zhangmenren.Untils;

// For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860

namespace zhangmenren.Areas.Admin.Controllers
{
	[Area(areaName: "Admin")]
	public class AdminController : ABaseController
	{
		private IAdminService _adminService;
		private ICacheService _cacheService;
        public AdminController(IAdminService adminService,ICacheService cacheService)
        {
			_adminService = adminService;
			_cacheService = cacheService;

		}




        /// <summary>
        /// 后台控制器
        /// </summary>
        /// <returns>The index.</returns>
        public IActionResult Index()
        {



			_cacheService.Add("key", "value");

			var aaa = _cacheService.Get("key");

            //if (entity?.Id == null)
            //{
            //    return  RedirectToAction("Login", "Admin");
            //}
            return View();
        }


        /// <summary>
        /// 后台欢迎页面
        /// </summary>
        /// <returns>The index.</returns>
        public IActionResult Welcome()
        {
            return View();
        }

        /// <summary>
        /// 退出登录
        /// </summary>
        /// <returns>The quit.</returns>
        public IActionResult Quit(){
            Cookie.DeleteCookie(HttpContext);
            return Redirect("/Admin/Login/Index");
        }

    }
}
